package com.glory.hikvisionmobile.activity;

import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.glory.hikvisionmobile.BuildConfig;
import com.glory.hikvisionmobile.R;
import com.glory.hikvisionmobile.base.Constant;
import com.glory.hikvisionmobile.bean.Login.LoginInfoBean;
import com.pda.platform.ui.ui_pdaplatform.base.FreeUI_BaseActivity;
import com.pda.platform.ui.ui_pdaplatform.entity.FreeUI_AddViewEntity;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_ActivityManager;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_StaticMembers;
import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_Utils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class SettingActivity extends FreeUI_BaseActivity {

    @BindView(R.id.tvIP)
    TextView tvIP;
    @BindView(R.id.rlIP)
    RelativeLayout rlIP;
    @BindView(R.id.tvVersion)
    TextView tvVersion;
    @BindView(R.id.llMain)
    LinearLayout llMain;
    @BindView(R.id.tvFileIP)
    TextView tvFileIP;
    @BindView(R.id.tvUser)
    TextView tvUser;
    @BindView(R.id.tvExit)
    TextView tvExit;
    private FreeApi_ActivityManager activityManager;


    @Override
    protected int getLayoutResId() {
        return R.layout.activity_setting;
    }

    @Override
    protected void initView() {
        freeUI_titleView.setTitle("设置");
    }

    @Override
    protected void initData() {
        tvVersion.setText(FreeApi_Utils.getVerName());
        tvIP.setText(BuildConfig.DEBUG ? Constant.REQUEST_URL_DEBUG : Constant.REQUEST_URL);
        tvFileIP.setText(BuildConfig.DEBUG ? Constant.FILE_URL_DEBUG : Constant.FILE_URL);
        tvUser.setText(Constant.LOGIN_BEAN.getDescription());
        activityManager = FreeApi_ActivityManager.getActivityManager();
        activityManager.addActivity(this);
    }

    @Override
    protected FreeUI_AddViewEntity getBaseEntity() {
        return new FreeUI_AddViewEntity(getIntent().getStringExtra(FreeApi_StaticMembers.SHOW_PLUGIN_KEY), llMain);
    }


    @OnClick(R.id.tvExit)
    public void onViewClicked() {
        Constant.LOGIN_BEAN = new LoginInfoBean();
        FreeApi_Utils.skipWithExtraIntent("header",SettingActivity.this,LoginActivity.class);
        activityManager.finishAllActivity();
    }
}

